/*     */ package com.zimbra.qa.unittest.prov;
/*     */ 
/*     */ import com.zimbra.cs.ldap.unboundid.InMemoryLdapServer;
/*     */ import org.junit.Rule;
/*     */ import org.junit.rules.TestName;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class ProvTest
/*     */ {
/*     */   public static enum SkipTestReason
/*     */   {
/*  28 */     LONG_TEST("test takes too long to run"), 
/*     */     
/*     */ 
/*  31 */     CONNECTION_POOL_HEALTH_CHECK("connection pool health check does not work for InMemoryDirectoryServer"), 
/*  32 */     DN_SUBTREE_MATCH_FILTER("entryDN:dnSubtreeMatch filter is not supported by InMemoryDirectoryServer"), 
/*  33 */     EXTERNAL_AUTH_STATUS_AUTH_FAILED("external auth STATUS_AUTH_FAILED status is not supported by InMemoryDirectoryServer"), 
/*  34 */     EXTERNAL_AUTH_STATUS_COMMUNICATION_FAILURE("external auth STATUS_COMMUNICATION_FAILURE status is not supported by InMemoryDirectoryServer"), 
/*  35 */     EXTERNAL_AUTH_STATUS_CONNECTION_REFUSED("external auth STATUS_CONNECTION_REFUSED status is not supported by InMemoryDirectoryServer"), 
/*  36 */     EXTERNAL_AUTH_STATUS_UNKNOWN_HOST("external auth STATUS_UNKNOWN_HOST status is not supported by InMemoryDirectoryServer"), 
/*  37 */     SUBORDINATES_OPERTIONAL_ATTRIBUTE("Subordinates operational attribute is not supported by InMemoryDirectoryServer"), 
/*  38 */     DYNAMIC_GROUP_OVERLAY("Dynamic group overlay is not supported by InMemoryDirectoryServer");
/*     */     
/*     */     private String notes;
/*     */     
/*  42 */     private SkipTestReason(String notes) { this.notes = notes; }
/*     */   }
/*     */   
/*     */   public static class SkippedForInMemLdapServerException extends Exception
/*     */   {
/*     */     public SkippedForInMemLdapServerException(ProvTest.SkipTestReason reason) {
/*  48 */       super();
/*     */     }
/*     */   }
/*     */   
/*     */   public static class SkippedForRealLdapServerException extends Exception {
/*     */     public SkippedForRealLdapServerException(ProvTest.SkipTestReason reason) {
/*  54 */       super();
/*     */     }
/*     */   }
/*     */   
/*     */   protected void SKIP_FOR_INMEM_LDAP_SERVER(SkipTestReason reason) throws ProvTest.SkippedForInMemLdapServerException
/*     */   {
/*  60 */     if (InMemoryLdapServer.isOn()) {
/*  61 */       throw new SkippedForInMemLdapServerException(reason);
/*     */     }
/*     */   }
/*     */   
/*     */   protected void SKIP_FOR_REAL_LDAP_SERVER(SkipTestReason reason) throws ProvTest.SkippedForRealLdapServerException
/*     */   {
/*  67 */     if (!InMemoryLdapServer.isOn()) {
/*  68 */       throw new SkippedForRealLdapServerException(reason);
/*     */     }
/*     */   }
/*     */   
/*     */   public static class Sequencer {
/*  73 */     private int next = 1;
/*     */     
/*     */ 
/*  76 */     public int next() { return this.next++; }
/*     */   }
/*     */   
/*     */   @Rule
/*  80 */   public TestName TEST_NAME = new TestName();
/*     */   
/*     */   protected String getTestName()
/*     */   {
/*  84 */     return this.TEST_NAME.getMethodName();
/*     */   }
/*     */   
/*     */   private String genName(String suffix, Sequencer seq) {
/*  88 */     String name = getTestName() + "-" + suffix;
/*     */     
/*     */ 
/*  91 */     if (seq != null) {
/*  92 */       name = name + "-" + seq.next();
/*     */     }
/*  94 */     return name.toLowerCase();
/*     */   }
/*     */   
/*     */   private String genName(String suffix) {
/*  98 */     return genName(suffix, null);
/*     */   }
/*     */   
/*     */   private String genName() {
/* 102 */     return genName(null);
/*     */   }
/*     */   
/*     */   protected String genAcctNameLocalPart(String suffix, Sequencer seq) {
/* 106 */     return "acct-" + genName(suffix, seq);
/*     */   }
/*     */   
/*     */   protected String genAcctNameLocalPart(String suffix) {
/* 110 */     return genAcctNameLocalPart(suffix, null);
/*     */   }
/*     */   
/*     */   protected String genAcctNameLocalPart(Sequencer seq) {
/* 114 */     return genAcctNameLocalPart(null, seq);
/*     */   }
/*     */   
/*     */   protected String genAcctNameLocalPart() {
/* 118 */     return genAcctNameLocalPart(null, null);
/*     */   }
/*     */   
/*     */   protected String genCalendarResourceNameLocalPart(String suffix) {
/* 122 */     return "cr-" + genName(suffix);
/*     */   }
/*     */   
/*     */   protected String genCalendarResourceNameLocalPart() {
/* 126 */     return genCalendarResourceNameLocalPart(null);
/*     */   }
/*     */   
/*     */   protected String genDataSourceName(String suffix, Sequencer seq) {
/* 130 */     return "ds-" + genName(suffix, seq);
/*     */   }
/*     */   
/*     */   protected String genDataSourceName(String suffix) {
/* 134 */     return genDataSourceName(suffix, null);
/*     */   }
/*     */   
/*     */   protected String genDataSourceName(Sequencer seq) {
/* 138 */     return genDataSourceName(null, seq);
/*     */   }
/*     */   
/*     */   protected String genDataSourceName() {
/* 142 */     return genDataSourceName(null, null);
/*     */   }
/*     */   
/*     */   protected String genIdentityName(String suffix, Sequencer seq) {
/* 146 */     return "iden-" + genName(suffix, seq);
/*     */   }
/*     */   
/*     */   protected String genIdentityName(String suffix) {
/* 150 */     return genIdentityName(suffix, null);
/*     */   }
/*     */   
/*     */   protected String genIdentityName(Sequencer seq) {
/* 154 */     return genIdentityName(null, seq);
/*     */   }
/*     */   
/*     */   protected String genIdentityName() {
/* 158 */     return genIdentityName(null, null);
/*     */   }
/*     */   
/*     */   protected String genGroupNameLocalPart(String suffix, Sequencer seq) {
/* 162 */     return "group-" + genName(suffix, seq);
/*     */   }
/*     */   
/*     */   protected String genGroupNameLocalPart(String suffix) {
/* 166 */     return genGroupNameLocalPart(suffix, null);
/*     */   }
/*     */   
/*     */   protected String genGroupNameLocalPart(Sequencer seq) {
/* 170 */     return genGroupNameLocalPart(null, seq);
/*     */   }
/*     */   
/*     */   protected String genGroupNameLocalPart() {
/* 174 */     return genGroupNameLocalPart(null, null);
/*     */   }
/*     */   
/*     */   protected String genCosName(String suffix) {
/* 178 */     return "cos-" + genName(suffix);
/*     */   }
/*     */   
/*     */   protected String genCosName() {
/* 182 */     return genCosName(null);
/*     */   }
/*     */   
/*     */   protected String genDomainSegmentName(String suffix) {
/* 186 */     return genName(suffix);
/*     */   }
/*     */   
/*     */   protected String genDomainSegmentName() {
/* 190 */     return genDomainSegmentName(null);
/*     */   }
/*     */   
/*     */   protected String genDomainName(String baseDomainName) {
/* 194 */     return genDomainSegmentName() + "." + baseDomainName;
/*     */   }
/*     */   
/*     */   protected String genServerName(String suffix) {
/* 198 */     return "server-" + genName(suffix);
/*     */   }
/*     */   
/*     */   protected String genServerName() {
/* 202 */     return genServerName(null);
/*     */   }
/*     */   
/*     */   protected String genSignatureName(String suffix, Sequencer seq) {
/* 206 */     return "sig-" + genName(suffix, seq);
/*     */   }
/*     */   
/*     */   protected String genSignatureName(String suffix) {
/* 210 */     return genSignatureName(suffix, null);
/*     */   }
/*     */   
/*     */   protected String genSignatureName(Sequencer seq) {
/* 214 */     return genSignatureName(null, seq);
/*     */   }
/*     */   
/*     */   protected String genSignatureName() {
/* 218 */     return genSignatureName(null, null);
/*     */   }
/*     */   
/*     */   protected String genXMPPName(String suffix) {
/* 222 */     return "xmpp-" + genName(suffix);
/*     */   }
/*     */   
/*     */   protected String genXMPPName() {
/* 226 */     return genXMPPName(null);
/*     */   }
/*     */   
/*     */   protected String genZimletName() {
/* 230 */     return "zimlet-" + genName();
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/qa/unittest/prov/ProvTest.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */